#ifndef PICTUREBOX_H
#define PICTUREBOX_H

#include <QWidget>
#include <QImage>

class PictureBoxPrivate;
class PictureBox : public QWidget
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(PictureBox)

public:
    explicit PictureBox(QWidget *parent = nullptr);

public Q_SLOTS:
    void setImage(const QImage& image);

private:
    void fitWindow();

protected:
    virtual void paintEvent(QPaintEvent *) override;        // 绘制图片
    virtual void resizeEvent(QResizeEvent* event) override; // 改变窗口大小

private:
    PictureBoxPrivate *d_ptr;
};

#endif // PICTUREBOX_H
